import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class MC0430女儿国点名 {
    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        // code here
        int n = input.nextInt();
        int m = input.nextInt();
        ArrayList<String> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(input.next());
        }
//        Collections.sort(list);
        list.sort(String::compareTo);
        for (String s : list) {
            System.out.println(s);
        }
        System.out.println(list.get(m-1));
        input.close();
    }
}
